/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const ll maxn = 1100;
vector<ll> p[1100];
bool vis[maxn];
vector<ll> in0;
ll n, m, X, Y;
bool h[maxn], g[maxn];
ll col[maxn];
ll H[maxn], G[maxn];

bool dfs(ll u, ll f)
{
    vis[u] = true;
    ll len = p[u].size();
    for (ll i = 0; i < len; i++)
    {
        ll v = p[u][i];
        if (v == f)
            continue;
        if (col[v] != -1 && !vis[v])
        {
            if (col[v] != 1 - col[u])
                return false;
            else if (!dfs(v, u))
                return false;
            continue;
        }
        if (vis[v])
        {
            if (col[v] != 1 - col[u])
                return false;
            continue;
        }
        col[v] = 1 - col[u];
        if (!dfs(v, u))
        {
            return false;
        }
    }
    return true;
}

int main()
{
    IOS;
    ll x, y;
    bool flag;
    while (cin >> n >> m >> X >> Y)
    {
        flag = false;
        in0.clear();
        for (ll i = 1; i <= n; i++)
        {
            p[i].clear();
            vis[i] = false;
            h[i] = false;
            g[i] = false;
        }
        for (ll i = 1; i <= m; i++)
        {
            cin >> x >> y;
            p[x].push_back(y);
            p[y].push_back(x);
            vis[x] = vis[y] = true;
        }
        for (ll i = 1; i <= n; i++)
        {
            if (!vis[i])
                in0.push_back(i);
        }
        memset(col, -1, sizeof(col));
        for (ll i = 1; i <= X; i++)
        {
            cin >> x;
            col[x] = 0;
            h[x] = true;
            H[i] = x;
        }
        for (ll i = 1; i <= Y; i++)
        {
            cin >> x;
            col[x] = 1;
            G[i] = x;
            g[x] = true;
        }
        memset(vis, false, sizeof(vis));
        ll len = in0.size();
        for (ll i = 0; i < len; i++)
        {
            vis[in0[i]] = true;
            if (h[in0[i]] || g[in0[i]])
                continue;
            else
            {
                cout << "NO" << endl;
                flag = true;
                break;
            }
        }
        if (flag)
            continue;
        for (ll i = 1; i <= X; i++)
        {
            if (vis[i])
                continue;
            if (!dfs(H[i], -1))
            {
                cout << "NO" << endl;
                flag = true;
            }
        }
        if (flag)
            continue;
        for (ll i = 1; i <= Y; i++)
        {
            if (vis[i])
                continue;
            if (!dfs(G[i], -1))
            {
                cout << "NO" << endl;
                flag = true;
            }
        }
        if (flag)
            continue;
        for (ll i = 1; i <= n; i++)
        {
            if (vis[i])
                continue;
            col[i] = 0;
            if (!dfs(i, -1))
            {
                cout << "NO" << endl;
                flag = true;
            }
        }
        if (flag)
            continue;
        cout << "YES" << endl;
    }
    getchar();
    getchar();
    return 0;
}
